package com.trippin.Utils;

import java.util.Comparator;

import com.trippin.DB.entities.StickyNoteEntity;

public class StickyNoteComparator implements Comparator<StickyNoteEntity> {

	@Override
	public int compare(StickyNoteEntity stkn1, StickyNoteEntity stkn2) {
		if(stkn1.getStart() == null) {
			return -1;
		}
		else if(stkn2.getStart() == null) {
			return 1;
		}
		else if(stkn1.getStart().before(stkn2.getStart())) {
			return 1;
		}
		else if(stkn1.getEnd() == null) {
			return -1;
		}
		else if(stkn2.getEnd() == null) {
			return 1;
		}
		else if(stkn1.getEnd().before(stkn2.getEnd())) {
			return 1;
		}
		else {
			return -1;
		}
	}

}
